package com.hc.demo.mapper;

import com.hc.demo.domain.Orders;
import com.hc.demo.dto.CalendarResponseDto;
import com.hc.demo.dto.OrdersMapperDto;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options;

import java.util.List;

public interface OrdersMapper {

    // 使用useGeneratedKeys返回自增主键
    @Insert("INSERT INTO orders(orderId,userId,hpId,smId,state,orderDate) " +
            "VALUES(#{orderId}, #{userId}, #{hpId},#{smId}, #{state}, #{orderDate})")
    @Options(useGeneratedKeys = true, keyProperty = "orderId")
    int insertOrder(Orders order);


    int deleteByPrimaryKey(Integer orderId);

    int insert(Orders record);

    int insertSelective(Orders record);

    Orders selectByPrimaryKey(Integer orderId);

    int updateByPrimaryKeySelective(Orders record);

    int updateByPrimaryKey(Orders record);

    //如何查询某天某个医院已经约号的数量： 2025年8月25号  医院编号是1  订单有3个  200-3=197
    int selectAppointmentCountByhpidByDate(Orders orders);

    List<CalendarResponseDto> listOrdersAppointmentNumber(List<OrdersMapperDto> parameList);
}